<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const arr = [2, 3, 4, 1, 2, 3, 1, 5, 3, 4, 6, 1, 3]
        function fn(arr) {
            const obj={}
            obj.max=0
            //console.log(arr)
            arr.forEach(item=>{
                    if(obj[item]){
                        obj[item]+=1
                        if(obj[item]>obj.max){
                            obj.max=obj[item]
                            obj.maxitem=item
                        }
                        }else{
                            obj[item]=1
                        }
                        }
            )
            return obj
        }
        console.log(fn(arr))
    </script>
</body>
</html>